package com.itheima.app.controller;

import com.itheima.app.manager.TestManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
public class TestController {
    @Autowired
    private TestManager testManager;
    //测灵魂-问卷列表（学生实战）
    @GetMapping("/testSoul")
    public ResponseEntity findTest(){
        return testManager.findTest();
    }
    //测灵魂-提交问卷（学生实战）
    @PostMapping("/testSoul")
    public ResponseEntity sendTest(@RequestBody Map<String,Map<String,String>[]> param){
        Map<String, String>[] answers = param.get("answers");
        return testManager.sendTest(answers);
    }
    //测灵魂-查看结果（学生实战）
    @GetMapping("/testSoul/report/{reportId}")
    public ResponseEntity reportRes(@PathVariable String reportId){
        return testManager.reportRes(reportId);
    }
}
